<template>
	<view class="page bg-white">
		<!-- 标题栏 start -->
		<fu-custom :isBack="true" :isBottom="true" bgColor="bg-white">
			<block slot="content">{{ i18n['注销账号'] }}</block>
		</fu-custom>
		<view class="padding-lr">
      <view class="padding-tb solid-bottom">
        <view class="margin-bottom fu-fs32 text-bold text-333">{{ i18n['账号注销'] }}</view>
        <view class="fu-fs28 text-666">{{ i18n['永久注销且无法恢复，请谨慎操作'] }}</view>
      </view>
      <view class="padding-tb solid-bottom">
        <view class="margin-bottom fu-fs32 text-bold text-333">{{ i18n['账号注销后将放弃以下权益'] }}</view>
        <view class="fu-fs28 text-666">
        	1、账号信息、第三方授权信息将被清空且无法恢复。
        	2、账号相关信息将会一并被删除且无法恢复。
        	3、注销后手机号码可重新注册，所生成账号为全新的账号，不包含注销账号的任何信息。
        </view>
      </view>
			<view class="padding-tb">
				<view class="text-vecode">{{ i18n['点击下方按钮，即表示你已阅读并了解以上风险'] }}</view>
			</view>
      <view class="btn-wrap">
        <view class="fu-fs32 text-center bg-theme text-white margin-lr height-88 line-height-88 round" @click="handleNext">
        	{{ i18n['我已清楚风险，确定继续'] }}
        </view>
        <view class="fu-fs32 text-center text-theme line-theme margin-lr height-88 line-height-88 round margin-top solid" @click="handleJump" data-type="BACK">
        	{{ i18n['返回'] }}
        </view>
      </view>
		</view>
		<!-- 断网监测 start -->
		<fu-notwork></fu-notwork>
		<!-- 断网监测 end -->
	</view>
</template>

<script>
	export default {
		data() {
			return {
				unset_reason: '', // 理由
				unset_type: '', // 原因
				themeColor:'#B82441'
			}
		},
		onLoad(options) {
      const { unset_reason, unset_type } = options;
			this.unset_reason = unset_reason;
			this.unset_type = unset_type;
		},
		methods: {
			handleNext() {
        this.$util.showModal({
        	title: this.i18n['提示'],
        	content: '请再次确认，你已了解注销风险，并要继续执行该操作',
        	confirmColor: this.themeColor,
        	success: (res) => {
        		if (res.confirm) {
        			this.$api.post(global.apiUrls.cancelAccountSub, {
        				unset_type: this.unset_type,
        				unset_reason: this.unset_reason
        			}).then(result => {
        				if (result.data.code == 1) {
                  uni.$emit('cancelAccount')
                  this.$urouter.redirectTo({
                    url: '/pages/index/setting/cancel-account/cancel-success/index'
                  })
        				} else {
        					this.$message.info(result.data.msg);
        				}
        			}).catch(err => {
              })
        		}
        	}
        });
			}
		},
	}
</script>

<style lang="scss" scoped>
  .btn-wrap {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 50rpx;
  }
</style>
